import _classCallCheck from 'babel-runtime/helpers/classCallCheck';

var RequestError = function () {
  function RequestError(status, statusText, errors) {
    _classCallCheck(this, RequestError);

    this.name = 'RequestError';
    this.status = status;
    this.statusText = statusText || 'Request Error';
    this.errors = errors;
  }

  RequestError.prototype.formatErrorMessage = function formatErrorMessage() {
    var errorMsg = this.status + ' ' + this.statusText;

    if (this.errors) {
      errorMsg = typeof this.errors === 'string' ? this.errors : this.errors.join('\n');
    }

    return errorMsg;
  };

  return RequestError;
}();

export default RequestError;